home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!vsoft.demon.co.uk
- From: Rik Barker <R-Barker@vsoft.demon.co.uk>
- Newsgroups: comp.lang.c++
- Subject: Help! problem with open()
- Date: Thu, 01 Feb 1996 12:24:24 GMT
- Organization: Visionsoft Limited
- Message-ID: <608213585wnr@vsoft.demon.co.uk>
- Reply-To: R-Barker@vsoft.demon.co.uk
- X-NNTP-Posting-Host: vsoft.demon.co.uk
- X-Broken-Date: Thursday, Feb 01, 1996 12.24.24
- X-Newsreader: Newswin Alpha 0.7
- X-Mail2News-Path: disperse.demon.co.uk!post.demon.co.uk!vsoft.demon.co.uk
-
- Hi,
-
- I've got a really odd problem with open().
- The code I have works on 90% of the PCs I try it on, and fails on
- Dells, some AST, and some ACER PCs.
-
- Does anyone know a way around this? It's quite urgent.
-
-
- Here's the code that fails.
- It fails when Opening the file for writing. I stuck perror() in and
- got back "Invalid Argument"
-
- Both FromTwo, and FileTwo are char *
- Any help _Hugely_ Appreciated, I'm baffled.
-
- Cheers,
- Rik.
-
- *******************************************
- if ((xin=open(FromTwo,O_RDONLY | O_BINARY))== -1)
- {
- printf("Error: Problem Reading File (1)\n");
- return FALSE;
- }
-
- if ((xout=open(FileTwo,O_CREAT|O_TRUNC|O_WRONLY|O_BINARY))==-1)
- {
- printf("Error: Problem Writing File\n");
- close(xin);
- return FALSE;
- }
- else
- {
- while (!eof(xin))
- {
- if ((bytes=read(xin,cbuffer,1024)) == -1)
- return FALSE;
- else
- write(xout,cbuffer,bytes);
- }
- close(xin);
- close(xout);
- }
- ----------------------------------
- Any views expressed are my own,
- and may not be that of my employer
- ----------------------------------
- Rik | R-Barker@vsoft.demon.co.uk
- ----------------------------------
-
-